<%@ page contentType="text/html;charset=UTF-8" language="java"  import="java.util.*" trimDirectiveWhitespaces="true" %>
<%@include file="/WEB-INF/pages/common/taglib.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
    <title>拍照邮寄</title>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <%@include file="/WEB-INF/pages/common/commonCss.jsp"%>
    <link rel="stylesheet" href="${basePath}/resources/css/select2.css" />
    <link rel="stylesheet" href="${basePath}/resources/css/uniform.css" />
    <link rel="stylesheet" href="${basePath}/resources/css/matrix-style.css" />
    <link rel="stylesheet" href="${basePath}/resources/css/matrix-media.css" />
    <link rel="stylesheet" href="${basePath}/resources/css/bootstrap-wysihtml5.css" />

</head>

<style>
    .select2-container {
        float:left;
        width: 35%;
    }
</style>
<body>

<!--Header-part-->
<%@include file="/WEB-INF/pages/common/head.jsp"%>


<!--sidebar-menu-->
<%@include file="/WEB-INF/pages/common/left.jsp"%>

<div id="content">
    <div id="content-header">
        <div id="breadcrumb"> <a href="#" title="Go to Home" class="tip-bottom"><i class="icon-home"></i>首页</a>
            <a href="#" class="current">拍照邮寄</a> </div>
        <%--<h1>平台商品新增</h1>--%>
    </div>

    <div class="container-fluid">

        <div class="row-fluid">
            <div class="span12">
                <div class="widget-box">
                    <div class="widget-title"> <span class="icon"> <i class="icon-align-justify"></i> </span>
                        <h5></h5>
                    </div>
                    <div class="widget-content nopadding">
                        <form  id="form"  method="POST" class="form-horizontal" >
                            <input type="hidden" name="orderno" value="${orderno}" id="orderno">
                            <input type="hidden" value="${type}" name="type" id="type">

                            <div class="control-group">
                                <label class="control-label">快递公司编码:${order.logisticsnoComp}</label>
                                <div class="controls">
                                    <input  list="cars" name="logisticsnoComp" id="logisticsnocomp" value="${order.logisticsnoComp}" />
                                    <datalist id="cars">
                                        <c:forEach items="${express}" var="item">

                                                <option value="${item.number}" >${item.company}</option>

                                        </c:forEach>
                                    </datalist>
                                    <%--<select style="" name="logisticsnocomp" id="logisticsnocomp">--%>
                                        <%--<c:forEach items="${express}" var="item">--%>
                                            <%--<option value="${item.number}">${item.company}</option>--%>
                                        <%--</c:forEach>--%>
                                    <%--</select>--%>
                                    <span style="color:green">（可根据快递公司第一个首字母大写提示选择）</span>
                                </div>
                            </div>




                            <div class="control-group">
                                <label class="control-label">发货单号 :</label>
                                <div class="controls">
                                    <input type="text" class="span8"  name="logisticsno"
                                           placeholder="发货单号"  id="logisticsno" value="${order.logisticsno}" >
                                </div>
                            </div>




                            <div class="form-actions">
                                <div class="control-group">
                                    <div class="controls">
                                        <button type="button" onclick="good.submit()" class="btn btn-success">保存</button>
                                        <button type="reset" class="btn btn-default"  onclick="history.go(-1)">返回</button>
                                    </div>
                                </div>
                            </div>

                        </form>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>


<!-- Modal -->

</div>



<!--Footer-part-->
<%@include file="/WEB-INF/pages/common/footer.jsp"%>

<!--end-Footer-part-->

<%@include file="/WEB-INF/pages/common/commonJS.jsp"%>
<script src="${basePath}/resources/js/bootstrap.min.js"></script>
<script src="${basePath}/resources/js/jquery.uniform.js"></script>
<script src="${basePath}/resources/js/select2.min.js"></script>
<script src="${basePath}/resources/js/kindeditor-4.1.10/kindeditor.js"></script>
<script src="${basePath}/resources/js/kindeditor-4.1.10/lang/zh_CN.js"></script>
<script src="${basePath}/resources/js/kindeditor-4.1.10/plugins/code/prettify.js"></script>
<script type="text/javascript" src="${basePath}/resources/js/upload/upload.js"></script>


<script>


    var index = 1;
    var good = {
        submit: function () {
            var logisticsnocomp = $('#logisticsnocomp').val();
            var logisticsno = $('#logisticsno').val();
            var type =  $('#type').val();
            var orderno =  $('#orderno').val();
            if (isEmpty(logisticsnocomp)) {
                loading("请选择快递公司", 4);
                return;
            }
            if (isEmpty(logisticsno)) {
                loading("请填写发货单号", 4);
                $("#logisticsno").focus();
                return;
            }
           var data = {logisticsnocomp:logisticsnocomp,logisticsno:logisticsno,orderno:orderno} ;
            console.log(JSON.stringify(data));
           $.ajax({
               url:adminPath + "/order/updateOrder",
               type:"post",
               data:data,
               success:function (data) {
                   console.log("2==="+data);
                  if(data==1){
                      var  returnUrl = "";
                      if("001"==type){
                          returnUrl =  "refurbish/detail";
                      }
                      if("002"==type){
                          returnUrl =  "repair/detail";
                      }
                      if("003"==type){
                          returnUrl =  "testing/detail";
                      }
                      if("004"==type){
                          returnUrl =  "recycle/detail";
                      }
                      if("005"==type){
                          returnUrl =  "exchange/detail";
                      }
                      if("006"==type){
                          returnUrl =  "shoporder/detail";
                      }
                      console.log(adminPath + "/order/" +returnUrl +"/"+ orderno);

                      window.location.href = adminPath + "/order/" +returnUrl +"/"+ orderno;
                  }else{
                      loading("修改失败",3);
                  }
               }

           });
        },


    };

    function tz_uploadsuccess(jdata ,obj) {
        if (jdata.target ==0) {
            console.log(JSON.stringify(jdata.name) );
            $(obj).attr("src", basePath + "/" + jdata.url + "?" + new Date().getTime());
            $(obj).parent().prev().val(JSON.stringify(jdata.name));
//          $("#bannerurl").val(JSON.stringify(jdata.name));
        } else if (jdata.target == "#audio") {
            $(jdata.target).attr("src", basePath + "/" + jdata.url).data("link", jdata.url);
            $("#musictitle").val(jdata.name);
            $("#musicsize").val(jdata.size);
            $("#musiclink").val(jdata.url);
            adminBlog.audioDom.oncanplaythrough = function () {
                var time = this.duration;
                var m = Math.ceil(time / 60);
                var s = Math.ceil(time % 60);
                if (m < 10) m = "0" + m;
                if (s < 10) s = "0" + s;
                $("#musictime").val(m + ":" + s);
            }
        }
    }


</script>
<script>
    imgerr.init();
</script>
</body>
</html>
